<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ page import="org.lsms.dao.impl.*" %>
<%@ page import="org.lsms.bean.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>Member Decision Page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="LSMS,ICSEE,MEMBER">
	
	<link rel="stylesheet" type="text/css" href="../css/author_layout.css">
	<link rel="stylesheet" type="text/css" href="../css/hyper_link_style.css">

	<style type="text/css">
	
		#paper_decision td{
			text-align:center;
		}
	
	</style>
	
	<script type="text/javascript">
	
	function openpage(curpage)
	{
		document.spage.page.value = curpage ;		
		document.spage.submit() ;
	}
	
	</script>

  </head>
  
  <body>
	<div id="container">
		<div id="header" class="logo_image"></div>
		<div class="nav"></div>
		<div id="author_menu" class="border">
			<table border="0" width="100%"  >
				<tr>
					<td  bgcolor="#CCCCCC"><a href="../index.jsp">Home</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="select_topic.jsp">Select Topics</a></td>
				</tr>
				<tr>
				<%
					DaoImpl impl = new DaoImpl();
					HashMap<String,Integer> hm = impl.get_site_setting();
					int reviewer_invite = hm.get("reviewer_invite");
					if(reviewer_invite==1){
				 %>
					<td  bgcolor="#CCCCCC"><a href="invite_reviewer.jsp">Invite Reviewer</a></td>
				<%
					}else{
				 %>
				 	<td  bgcolor="#CCCCCC"><a href="../error/invite_reviewer_forbidden.jsp">Invite Reviewer</a></td>	
				<%
					}
				 %>	
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="reviewer_conf.jsp">Reviewer Confirmation</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="paper_assign.jsp">Paper Status/Paper Assign</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="member_decision.jsp">Decision</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="modify_info.jsp">Modify Information</a></td>
				</tr>
				<tr>
					<td  bgcolor="#CCCCCC"><a href="../logout">Log Out</a></td>
				</tr>
			</table>
		</div>
		
		<div id="content" class="bg_color border">
			<div style="margin:15px">
			<p><b>Decision</b></p>
			<p align="left">Under Decision Paper</p>
			
				<div id="paper_decision" class="border">
				<table align="center" border="0" style="width:650px">
				<tr>
					<th>Paper ID</th>
					<th>Topics</th>
					<th>Title</th>
					<th>Author(s)</th>
					<th>Reviewer(s)</th>
					<th>&nbsp;</th>
				</tr>	
				<%
					int member_id = Integer.parseInt(session.getAttribute("userid").toString());
					int page_count = 1;
					int row = 2;
					int sum_page = 1;
					int sum_row = impl.get_member_undecision_paper_num(member_id);
					try{
						page_count = Integer.parseInt(request.getParameter("page"));
						sum_row = Integer.parseInt(request.getParameter("sum_row"));
					}catch(Exception e){};
					HashMap<String,List<Paper>> map = impl.get_member_undecision_paper(member_id,page_count,row);
				 	List<Paper> list = map.get("all");
				 	Iterator it = list.iterator();
				 	if(list.size()<1){
				 %>
				 <tr>
				 	<td>
				 	<%
				 		out.print("No Paper Undeieded!");
				 	 %>
				 	</td>
				 </tr>
				 <%
				 	}
				 	for(int i=0;i<list.size();i++){
				 		Paper paper = list.get(i);
				  %>
				 <tr>
				 	<td>
				 	<%
				 		out.print(paper.getPaperid());
				 	 %>
				 	</td>
				 	<td>
				 	<%
				 		String topics = "";
				 		String topic1 = paper.getFirsttopic();
				 		String topic2 = paper.getSecondtopic();
				 		topics = topic1 + "&" +topic2;
				 		out.print(topics);
				 	 %>
				 	</td>
				 	<td>
				 	<%
				 		out.print(paper.getPapertitle());
				 	 %>
				 	</td>
				 	<td>
				 	<%
				 		out.print(paper.getAuthorname());
				 	 %>
				 	</td>
				 	<td>
				 	<%
				 		int reviewer_num = impl.get_reviewer_num_of_one_paper(paper.getPaperid(),member_id);
				 	 	out.print(reviewer_num);
				 	 %>
				 	</td>
				 	<td>
				 	<a href="member_decision_detail.jsp?paper_id=<%=paper.getPaperid()%>">Enter</a>
				 	</td>
				 </tr>
				 <%
				 	}
				  %>
				</table>
				</div>
			
			<form action="member_decision.jsp" method="post" name="spage">
				<table width="95%" border="0" align="center">
				<tr>
					<td>
					&nbsp;
					</td>
					<td>
					<%
						sum_page = (sum_row + row -1) / row;
						if(list.size()>=1){
					%>
				 	<div align="center">
				 	<input type="button" value="First" onClick="openpage(1)"
				  	<%=page_count==1 ? "disabled" : "" %>>
				 
				 	<input type="button" value="Preivew" onClick="openpage(<%=page_count-1%>)"
				  	<%=page_count==1? "disabled" : "" %>>
				 
				 	<input type="button" value="Next" onClick="openpage(<%=page_count+1%>)"
				  	<%=page_count==sum_page? "disabled" : "" %>>
				 
				 	<input type="button" value="Last" onClick="openpage(<%=sum_page%>)"
				  	<%=page_count==sum_page? "disabled" : "" %>>
				 
				 	<input type="hidden" name="page" value="">&nbsp;
				 
				 	<font color="red" size="3"><%=page_count%></font> /
				 	<font color="red" size="3"><%=sum_page%></font>
				 
				 	</div>
				 	<%
				 	}
				  	%>
					</td>
				</tr>
				</table>
				</form>	
			
			</div>
		</div>
		
		<div class="nav"></div>
			
		<div id="footer" class="footer_color border">
			<p align="center"><b>&copy;2010 LSMS-All Rights Reserved.</b></p>
			<p align="center"> <b>Powered by Shu.</b></p>
		</div>
	</div>
  </body>
</html>
